<script setup>
import { ref } from 'vue';
import { useRouter } from 'vue-router';

const active = ref(3);
const router = useRouter();

const homepage = function() {
  if (router.currentRoute.value.path !== '/home/homepage') {
    router.push('homepage');
  }
}

const home = function() {
  if (router.currentRoute.value.path !== '/home/') {
    router.push({ name: 'logged_2' });
  }
}

const video = function() {
  if (router.currentRoute.value.path !== '/home/video') {
    router.push('video');
  }
}

const qust = function() {
  if (router.currentRoute.value.path !== '/home/qust') {
    router.push('qust');
  }
}
</script>


<template>
  <div>
    <van-tabbar v-model="active">
      <van-tabbar-item icon="home-o" @click="homepage">首页</van-tabbar-item>
      <van-tabbar-item icon="chat-o" @click="qust">问答</van-tabbar-item>
      <van-tabbar-item icon="video-o" @click="video">视频</van-tabbar-item>
      <van-tabbar-item icon="user-o" @click="home">我的</van-tabbar-item>
    </van-tabbar>
  </div>
</template>

<style scoped>

</style>